<#assign menuId=4>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>下载装箱单-${Application.systemName!}</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- bootstrap 3.0.2 -->
        <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="../css/ionicons.min.css" rel="stylesheet" type="text/css" />
        <!-- Theme style -->
        <link href="../css/AdminLTE.css" rel="stylesheet" type="text/css" />
       
        <link href="../css/myself.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
            .table tr td{
            	text-align: left;
            }
            
        </style>
    </head>
    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
        <#include "../header.html"/>
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <#include "../menu.html"/>

            <!-- Right side column. Contains the navbar and content of the page -->
           <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>下载装箱单</h1>
                    <hr style="margin: 10px 0 0 0" /> 
            	</section>
                <!-- Main content -->
                <section class="content">
                    <div class='row' style="paddint-left: 10px;">
                        <div class='col-md-12'>
                            <div class='box clearfix' style="padding: 20px;">
                            	<form action="#" method="get" class="center">
                            		<table class="table text-center table-bordered">
                            			<tr>
                            				<th colspan="10" style="font-size: 15px">装箱单</th>
                            			</tr>
                            			<tr>
                            				<th width="10%">箱号</th>
                            				<th width="10%">箱子尺寸</th>
                            				<th width="10%">毛重</th>
                            				<th width="10%">净重</th>
                            				<th width="10%">颜色编码</th>
                            				<th width="10%">S</th>
                            				<th width="10%">M</th>
                            				<th width="10%">L</th>
                            				<th width="10%">XL</th>
                            				<th width="10%">合计</th>
                            			</tr>
                            			<#list historyList as history>
                            			<tr name="info">
                            				<td colspan="10">
                            					<table class="table no-border no-margin">
                            						<tr>
                            							<td width="10%">发出日期：</td>
                            							<td width="23%">&nbsp;
                            							<#if history.deliveryDate??>
                            							${history.deliveryDate?string("yyyy-MM-dd")}
                            							</#if>
                            							</td>
                            							<td width="10%">物流公司：</td>
                            							<td width="23%">&nbsp;${history.deliver!}</td>
                            							<td width="10%">物流编号：</td>
                            							<td width="23%">&nbsp;${history.batchNo!}</td>
                            						</tr>
                            					</table>
                            				</td>
                            			</tr>
                            			<#list history.encasementItems as 	encasementItem>	
																		
										<tr name="item">
											<td>${encasementItem.pNo!}</td>
											<td>${encasementItem.size!}</td>
											<td>${encasementItem.grossWeight!}</td>
											<td>${encasementItem.netWeight!}</td>
											<td>${encasementItem.colorCode!}</td>
								            <td name="size">${encasementItem.sAmount!}</td>
								            <td name="size">${encasementItem.mAmount!}</td>
								            <td name="size">${encasementItem.lAmount!}</td>
								            <td name="size">${encasementItem.xlAmouint!}</td>
								            <td name="total">${encasementItem.total!}</td>
								        </tr>
								        </#list>
                            			<tr>
                            				<td colspan="10">
                            					<span class="bold">合计箱数：${history.encasementItems?size}箱</span>&nbsp;&nbsp;
                            					<span class="bold">合计件数：<span id="count">0</span>件</span>
                            				</td>
                            			</tr>
                            			</#list>
                            		</table>
                            		
                            	</form>
                                <div class="center">
                                	<button type="button" class="btn btn-primary" id="down_encasement">下载</button>
                                	<button type="button" class="btn btn-default" onclick="history.back();">返回</button>
                                </div>
						     
						       	
                            </div><!-- /.box -->
                        </div><!-- /.col-->
                    </div><!-- ./row -->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
        <!-- jQuery 2.0.2 -->
        <style type="text/css"></style>
        
        <!-- jQuery 2.0.2 -->
        <script src="../js/jquery.min.js"></script>
        <!-- Bootstrap -->
        <script src="../js/bootstrap.min.js" type="text/javascript"></script>
        <!-- AdminLTE App -->
        <script src="../js/AdminLTE/app.js" type="text/javascript"></script>
        <!-- AdminLTE for demo purposes -->   
        <script src="../js/html2canvas.js" type="text/javascript"></script>    
      	<script src="../js/order/production_encasement_down.js" type="text/javascript"></script>        
        
       	<script type="text/javascript">
			
       		$(function(){
       			$('#down_encasement').click(down);
       		})
       		function down(){
       			exportPdf($('form').eq(1),'${productionPatternId!}');
       		}
       		$(function(){
       			var infos=$('[name="info"]');
       			for(var i=0;i<infos.length;i++){
       				var item=infos.eq(i).next();
       				var amount=0;
       				var total=0;
       				while(item.attr('name')){
       					var tds=item.find('[name="size"]');
       					for(var j=0;j<tds.length;j++){
       						var count=tds.eq(j).html();
   							if(count&&!isNaN(count)){
   								total+=parseInt(count);
   							}
       					}
       					item.find('[name="total"]').html(total);
       					amount+=total;
       					item=item.next();
       				}
       				item.find('#count').html(amount);
       			}
       		})
       	</script>

    </body>
</html>

